package com.xy.tianyu.module.picture.adapter

import android.widget.ImageView
import com.blankj.utilcode.util.ScreenUtils
import com.blankj.utilcode.util.SizeUtils
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xy.tianyu.R
import com.xy.tianyu.module.picture.bean.ItemX
import com.xy.tianyu.utils.GlideUtils

/**
 * @time 2020/10/12 16:39
 * @class 描述:
 */
class PicSetChildAdapter(layoutResId: Int, data:MutableList<ItemX>):BaseQuickAdapter<ItemX,BaseViewHolder>(layoutResId,data){
    override fun convert(holder: BaseViewHolder, item: ItemX) {
        val mIvPicSetChild = holder.getView<ImageView>(R.id.iv_pic_set_child)
        val params = mIvPicSetChild.layoutParams
        val size = (ScreenUtils.getScreenWidth()-SizeUtils.dp2px(20f))/3
        params.width = size
        params.height = size
        mIvPicSetChild.layoutParams = params

        Glide.with(context).load(item.pic_attrs.thumb_url).apply(GlideUtils.getRoundRequestOptions()).into(mIvPicSetChild)
    }
}